/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package SessionBeans;

import Classes.Priority;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Jaroslav
 */
@Stateless
public class PriorityFacade implements PriorityFacadeLocal {
    @PersistenceContext
    private EntityManager em;

    public void create(Priority priority) {
        em.persist(priority);
    }

    public void edit(Priority priority) {
        em.merge(priority);
    }

    public void remove(Priority priority) {
        em.remove(em.merge(priority));
    }

    public Priority find(Object id) {
        return em.find(Classes.Priority.class, id);
    }

    public List<Priority> findAll() {
        return em.createQuery("select object(o) from Priority as o").getResultList();
    }

}
